<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import = "java.sql.*" %>
<%@ page import = "javax.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	try			//jsp页面中可以不需要处理异常,因此try...catch不是必须的
	{
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		Connection connect = DriverManager.getConnection("jdbc:mysql://10.167.226.215/project","user","user");
		//创建connect时需要配置正确的IP地址，以及正确的数据库名称及用户名和密码
		Statement state = connect.createStatement();

		String command = "SELECT * FROM exchange_info";
		ResultSet rst = state.executeQuery(command);
		
		rst.beforeFirst();
		if(rst.next() != false)
		{
			String name = rst.getString("exchange_object");
			int point = rst.getInt("exchange_point");
			out.print("The name is:"+name+"; and the point is"+point+".");
		}
		rst.close();
		state.close();
		connect.close();
	}
	catch(Exception e)
	{
		out.print("We are very sorry that the system has occured an exception:"+e.toString());
	}
%>
</body>
</html>